﻿@page "{id?}"
@model AutoLot.Web.Pages.Cars.EditModel

@{
    //ViewData["Title"] = "Edit";
}

<h1>Edit @Model.Entity.PetName</h1>
<hr/>
@if (!string.IsNullOrEmpty(Model.Error))
{
    <div class="alert alert-danger" role="alert">
        @Model.Error
    </div>
}
else
{
    <form asp-page="Edit" asp-route-id="@Model.Entity.Id">
        <div class="row">
            <div class="col-md-4">
                <div asp-validation-summary="ModelOnly"></div>
                @Html.EditorFor(x => x.Entity, new { LookupValues = Model.LookupValues })
                <input type="hidden" asp-for="Entity.Id"/>
                <input type="hidden" asp-for="Entity.TimeStamp"/>
            </div>
        </div>
        <div class="d-flex flex-row mt-3">
            <button type="submit" class="btn btn-primary">Save <i class="fas fa-save"></i></button>&nbsp;&nbsp;|&nbsp;&nbsp;
            <item-list></item-list>
        </div>
    </form>
}
@section Scripts {
    @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
}